<?php

class QZip
{
    private $zip;
    private $objectsList = array();
    
    function __construct()
    {
        require_once($this->PATH . '/pclzip.lib.php');

        $this->zip = new PclZip(null);
    }

    public function Compress($arc)
    {
        $this->zip->zipname = $arc;
        
        $list = join(",", array_unique($this->objectsList));
        $this->zip->create($list);

        return $this;
    }

    public function Extract($arc, $dir)
    {
        $this->zip->zipname = $arc;
        $this->zip->extract($dir);

        return $this;
    }

    public function AddDir($dir)
    {
        $this->objectsList[] = $dir;
        
        return $this;
    }

    public function AddFile($file)
    {
        $this->objectsList[] = $dir;

        return $this;
    }

    public function AddData($data, $name)
    {
//        $this->zip->addData($name, $data);

        return $this;
    }
}